package kyFtp.utils
{
	import flash.net.Socket;
	
	/**
	 * @author 秦家洋
	 * @E-mail: develop@kongyue.cc
	 * 创建时间：2015-7-2 下午3:50:54
	 * 
	 */
	public class ExtendSocket extends Socket
	{
		public var host:String;
		public var port:int = 0;
		public function ExtendSocket(host:String=null, port:int=0)
		{
			super(host, port);
		}
		public function connectAgain():void
		{
			this.connect(host, port);
		}
		public static function parsePASVSock(responseStr:String):ExtendSocket
		{
			var sa:Array = responseStr.substring(responseStr.indexOf("(") + 1, responseStr.indexOf(")")).split(",");
			var dataIP:String = sa[0] + "." + sa[1] + "." + sa[2] + "." + sa[3];
			var dataPort:int = parseInt(sa[4]) * 256 + parseInt(sa[5]);
			return new ExtendSocket(dataIP,dataPort);
		}
	}
}